package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.util.Collection;
import java.util.Objects;

@Entity
@Table(name = "scheduling_class", schema = "jinsanjiao", catalog = "")
public class SchedulingClass {
    private int schedulingClassesId;
    private Time schedulingClassStartdate;
    private String schedulingClassTime;
    private String schedulingClassEnddate;
    private Collection<Scheduling> schedulingsBySchedulingClassesId;

    @Id
    @Column(name = "scheduling_classes_id", nullable = false)
    public int getSchedulingClassesId() {
        return schedulingClassesId;
    }

    public void setSchedulingClassesId(int schedulingClassesId) {
        this.schedulingClassesId = schedulingClassesId;
    }

    @Basic
    @Column(name = "scheduling_class_startdate", nullable = true)
    public Time getSchedulingClassStartdate() {
        return schedulingClassStartdate;
    }

    public void setSchedulingClassStartdate(Time schedulingClassStartdate) {
        this.schedulingClassStartdate = schedulingClassStartdate;
    }

    @Basic
    @Column(name = "scheduling_class_time", nullable = true, length = 30)
    public String getSchedulingClassTime() {
        return schedulingClassTime;
    }

    public void setSchedulingClassTime(String schedulingClassTime) {
        this.schedulingClassTime = schedulingClassTime;
    }

    @Basic
    @Column(name = "scheduling_class_enddate", nullable = true, length = 10)
    public String getSchedulingClassEnddate() {
        return schedulingClassEnddate;
    }

    public void setSchedulingClassEnddate(String schedulingClassEnddate) {
        this.schedulingClassEnddate = schedulingClassEnddate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SchedulingClass that = (SchedulingClass) o;
        return schedulingClassesId == that.schedulingClassesId &&
                Objects.equals(schedulingClassStartdate, that.schedulingClassStartdate) &&
                Objects.equals(schedulingClassTime, that.schedulingClassTime) &&
                Objects.equals(schedulingClassEnddate, that.schedulingClassEnddate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(schedulingClassesId, schedulingClassStartdate, schedulingClassTime, schedulingClassEnddate);
    }

    @OneToMany(mappedBy = "schedulingClassBySchedulingClassesId")
    public Collection<Scheduling> getSchedulingsBySchedulingClassesId() {
        return schedulingsBySchedulingClassesId;
    }

    public void setSchedulingsBySchedulingClassesId(Collection<Scheduling> schedulingsBySchedulingClassesId) {
        this.schedulingsBySchedulingClassesId = schedulingsBySchedulingClassesId;
    }
}
